package com.cosmoplat.xikai.business.enums;

import com.cosmoplat.xikai.common.utils.StringUtils;
import lombok.Getter;

@Getter
public enum DeviceTricolourLightEnum {

    /**
     * 1.开灯
     * 2.关灯
     **/
    TURN_OFF_THE_LIGHT("0", "关灯"),
    TURN_ON_THE_LIGHT("1", "开灯");

    private String code;
    private String name;

    DeviceTricolourLightEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getCodeByName(String name) {
        if (StringUtils.isBlank(name)) {
            return null;
        }
        for (DeviceTricolourLightEnum value : values()) {
            if (value.getName().equals(name)) {
                return value.getCode();
            }
        }
        return null;
    }
}
